{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-}
{-# OPTIONS_GHC -O2 #-}

import Data.List
import Data.Maybe
import Data.Char
import Data.Array
import Data.Int
import Data.Ratio
import Data.Bits
import Data.Function
import Data.Ord
--import Control.Monad.State
import Control.Monad
import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as BS
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Map (Map)
import qualified Data.Map as Map
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
import Data.Sequence (Seq)
import qualified Data.Sequence as Seq
import Data.Tree
import Data.Graph

solve :: Int -> [[Int]] -> [[Int]]
solve n pairsets
    | n == 2    = [[head $ head pairsets],tail $ head pairsets]
    | otherwise = map (map fst) . groupBy ((==) `on` snd) . sortBy (compare `on` snd) $ IntMap.assocs ans
  where
    inSet = accumArray (||) False (0,222) [(x,True) | x <- [0..222], y <- [0..222], (arr ! (min x y, max x y)) > 0]
    arr = accumArray (+) 0 ((0,0),(222,222)) $ concatMap list2pairs pairsets
    list2pairs lst = [((x,y),1) | x <- lst, y <- lst, x < y]

    ans = execState (rec (0, 0)) IntMap.empty
    
    rec :: (Int, Int) -> State (IntMap Int) ()
    rec (v, l) | v > 222 = return ()
    rec (v, l) = do
        map <- get
        let doit = (inSet ! v) && IntMap.notMember v map
        when doit $ dfs (v, l)
        rec (v + 1, if doit then l + 1 else l)

    dfs (v, l) = do
        modify $ IntMap.insert v l
        forM_ [0..222] $ \t -> when (inSet ! t && (arr ! (min v t, max v t)) > 1) $ do
            map <- get
            when (IntMap.notMember t map) $ dfs (t, l)


parseInput = do 
    n <- readInt
    pairsets <- replicateM (n * (n - 1) `div` 2) $ do
        k <- readInt
        replicateM k readInt
    return (n, pairsets)
  where
    readInt = state $ fromJust . BS.readInt . BS.dropWhile isSpace
    readString = state $ BS.span (not . isSpace) . BS.dropWhile isSpace

main = do
    (n, pairsets) <- evalState parseInput <$> BS.getContents
    let answer = solve n pairsets
    forM_ answer $ \lst -> do
        putStr $ show $ length lst
        forM_ lst $ \num -> do
            putChar ' '
            putStr $ show num
        putChar '\n'

--{{{ Start of a minimal State Monad
class (Monad m) => MonadState s m | m -> s where
	get :: m s
	put :: s -> m ()

modify :: (MonadState s m) => (s -> s) -> m ()
modify f = do
	s <- get
	put (f s)

gets :: (MonadState s m) => (s -> a) -> m a
gets f = do
	s <- get
	return (f s)

newtype State s a = State { runState :: s -> (a, s) }

instance Functor (State s) where
	fmap f m = State $ \s -> let
		(a, s') = runState m s
		in (f a, s')

instance Applicative (State s) where
    pure = return
    (<*>) = ap

instance Monad (State s) where
	return a = State $ \s -> (a, s)
	m >>= k  = State $ \s -> let
		(a, s') = runState m s
		in runState (k a) s'

instance MonadState s (State s) where
	get   = State $ \s -> (s, s)
	put s = State $ \_ -> ((), s)

evalState :: State s a -> s -> a
evalState m s = fst (runState m s)

execState :: State s a -> s -> s
execState m s = snd (runState m s)

mapState :: ((a, s) -> (b, s)) -> State s a -> State s b
mapState f m = State $ f . runState m

withState :: (s -> s) -> State s a -> State s a
withState f m = State $ runState m . f

state = State
--}}} end of a minimal State Monad
